An algorithm to calculate correlated colour temperature